import { ComponentMetadata, Snippet } from '@alilc/lowcode-types';

const WasteManagementMeta: ComponentMetadata = {
  componentName: 'WasteManagement',
  title: '垃圾管理',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  group: '设施环境',
  category: '监控管理',
  priority: 0,
  npm: {
    package: 'hzdz-charts',
    version: '0.1.0',
    exportName: 'WasteManagement',
    main: 'src/index.tsx',
    destructuring: true,
    subName: '',
  },
  configure: {
    props: [
      {
        title: '基础配置',
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'title',
            title: '组件标题',
            setter: 'StringSetter',
            defaultValue: '垃圾管理',
          },
          {
            name: 'englishTitle',
            title: '英文标题',
            setter: 'StringSetter',
            defaultValue: 'Waste Management',
          },
        ],
      },
      {
        title: '统计数据配置',
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'statsData',
            title: '统计数据',
            setter: {
              componentName: 'ArraySetter',
              props: {
                itemSetter: {
                  componentName: 'ObjectSetter',
                  props: {
                    config: {
                      items: [
                        {
                          name: 'icon',
                          title: '图标',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'label',
                          title: '标签',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'value',
                          title: '数值',
                          setter: 'StringSetter',
                        },
                      ],
                    },
                  },
                },
              },
            },
            defaultValue: [
              { icon: 'http://localhost:8085/static/images/01备份.png', label: '垃圾量展示', value: '48,003' },
              { icon: 'http://localhost:8085/static/images/01.png', label: '清运时间', value: '14:40' },
              { icon: 'http://localhost:8085/static/images/01.png', label: '集置点所属单位', value: 'XXXX' },
              { icon: 'http://localhost:8085/static/images/01.png', label: '监控-漫溢预警', value: 'XXX' },
            ],
          },
        ],
      },
      {
        title: '视频监控配置',
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'videoData',
            title: '视频监控',
            setter: {
              componentName: 'ArraySetter',
              props: {
                itemSetter: {
                  componentName: 'ObjectSetter',
                  props: {
                    config: {
                      items: [
                        {
                          name: 'name',
                          title: '场房名称',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'videoUrl',
                          title: '视频流地址',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'thumbnail',
                          title: '预览图片',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'online',
                          title: '是否在线',
                          setter: 'BoolSetter',
                        },
                      ],
                    },
                  },
                },
              },
            },
            defaultValue: [
              { 
                name: '垃圾场房1', 
                thumbnail: 'http://localhost:8085/static/images/sheshihuanjing/编组44.png',
                online: true 
              },
              { 
                name: '垃圾场房2', 
                thumbnail: 'http://localhost:8085/static/images/sheshihuanjing/编组44.png',
                online: true 
              },
            ],
          },
        ],
      },
      {
        title: '事件处理',
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'onClick',
            title: '点击事件',
            setter: 'FunctionSetter',
          },
          {
            name: 'onStatClick',
            title: '点击统计项',
            setter: 'FunctionSetter',
          },
          {
            name: 'onVideoClick',
            title: '点击视频项',
            setter: 'FunctionSetter',
          },
        ],
      },
      {
        title: '外观',
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'style',
            title: '自定义样式',
            setter: 'StyleSetter',
          },
          {
            name: 'className',
            title: '自定义类名',
            setter: 'StringSetter',
          },
        ],
      },
    ],
    supports: {
      style: true,
      events: ['onClick', 'onStatClick', 'onVideoClick'],
    },
    component: {},
  },
};

const snippets: Snippet[] = [
  {
    title: '垃圾管理',
    screenshot: '',
    schema: {
      componentName: 'WasteManagement',
      props: {
        title: '垃圾管理',
        englishTitle: 'Waste Management',
        statsData: [
          { icon: 'http://localhost:8085/static/images/01备份.png', label: '垃圾量展示', value: '48,003' },
          { icon: 'http://localhost:8085/static/images/01.png', label: '清运时间', value: '14:40' },
          { icon: 'http://localhost:8085/static/images/01.png', label: '集置点所属单位', value: 'XXXX' },
          { icon: 'http://localhost:8085/static/images/01.png', label: '监控-漫溢预警', value: 'XXX' },
        ],
        videoData: [
          { 
            name: '垃圾场房1', 
            thumbnail: 'http://localhost:8085/static/images/sheshihuanjing/编组44.png',
            online: true 
          },
          { 
            name: '垃圾场房2', 
            thumbnail: 'http://localhost:8085/static/images/sheshihuanjing/编组44.png',
            online: true 
          },
        ],
      },
    },
  },
];

export default {
  ...WasteManagementMeta,
  snippets,
};